﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MakeIT.Deo.Negocios;

namespace MakeIT.Deo.Apresentacao
{
    public partial class BackOffice : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            usuario usuarioVO = (usuario)this.Session["userActive"];

            if (usuarioVO == null)
            {
                this.PanelLogin.Visible = true;
            }
            else
            {
                this.LiteralUsuario.Text = "Bem vindo " + usuarioVO.User;
                this.LiteralUsuario2.Text = "Backoffice Site DEO - Área restrita - "+this.LiteralUsuario.Text;
                string nomeDoControle = this.Request["controle"];
                if (nomeDoControle != null)
                {
                    ((HyperLink)this.FindControl(nomeDoControle)).CssClass = "active";
                }
            }
            string statusHeader = (string)this.Session["header"];
            if (statusHeader != null)
            {
                if (statusHeader.Equals("pequeno"))
                    MinimizeHeader_Click(null, null);
                else
                    ExpandHeader_Click(null, null);
            }

        }

        protected void ExpandHeader_Click(object sender, EventArgs e)
        {
            this.PanelHeaderPq.Visible = false;
            this.PanelHeaderGd.Visible = true;
            this.Session["header"] = "grande";
        }
        protected void MinimizeHeader_Click(object sender, EventArgs e)
        {
            this.PanelHeaderPq.Visible = true;
            this.PanelHeaderGd.Visible = false;
            this.Session["header"] = "pequeno";
        }

    }
}
